import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * This class its the submenu where the player can find the record on the game.
 * 
 * @author (Arturo Aaron Rios Obregon) 
 * @version (2 july 2013)
 */
public class RecordsWindow extends World
{
    private Return b;
    private GreenfootSound s;
    private ScoreBoard t;
    /**
     * Constructor for objects of class RecordsWindow.
     * 
     */
    public RecordsWindow()
    {    
        // Create a new world with 600x400 cells with a cell size of 1x1 pixels.
        super(600, 400, 1); 
        b = new Return();
        addObject(b,100,350);
        s = new GreenfootSound("recordsound.mp3");
        t = new ScoreBoard(500,220);
        addObject(t,getWidth()/2,getHeight()/2);
    }
    
    /**
     * Its the act method that check which button was touched.
     */
    public void act()
    {
        if(!s.isPlaying())
            s.play();
        if(Greenfoot.mousePressed(b))
         {
             s.stop();
             Greenfoot.setWorld(new Menu());
         }
    }
    
    /**
    * When the execution of the program stop the music stop too.
    */
    public void stopped()
    {
        s.pause();
    }
    
    /**
     * When the execution of the program is reanuded the music reanuded too.
     */
    public void started()
    {
        s.play();
    }
}
